class Solution {
    public int findJudge(int n, int[][] trust) {
        int f = trust[0][1];
        int count = 0;
        for (int[] edge : trust) {
            count++;
        }
        System.out.println(count);
        for(int i = 0; i < count; i ++) {
            if(trust[i][1] != f || trust[i][0] == f) {
                return -1;
            }
        }
        return f;
    }
}